<?php 

class Generos_x_peliculas_model extends CI_Model {



    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    function lista_generos_x_peliculas() {
    	$query = $this->db->get('generos_x_peliculas');
    	return $query;
    	
    }
    
    function consulta_criterios_generos_x_peliculas($data) {
    	$cadena_query = "SELECT * FROM generos_x_peliculas gp where gp.GEN_X_GEN IN (?)";
    	$query = $this->db->query($cadena_query, $data);
    	return $query;
    }
    
 function consulta_peliculas_x_generos($data) {
    	$cadena_query = "SELECT * FROM peliculas p where p.X_PEL IN (
    		select distinct(gp.PEL_X_PEL) from generos_x_peliculas gp where gp.GEN_X_GEN IN (".$data."))";
    	$query = $this->db->query($cadena_query, $data);
    	return $query;
    }
    
    
}